package com.gxa.web_admin.controller;

import com.gxa.common.vo.JsonResult;
import com.gxa.common.vo.R;
import com.gxa.modules.pojo.Agent;
import com.gxa.modules.service.AgentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.util.UUID;

@RestController
@RequestMapping("/agentl")
public class AgentController {
    @Autowired
    private AgentService agentService;

    /**
     * 分页查询承运商列表
     * @param currentPage
     * @param pageSize
     * @return
     */
    @GetMapping("/findAgent")
    public JsonResult findAgent(Integer currentPage, Integer pageSize){
        return agentService.findAgent(currentPage,pageSize);
    }

    /**
     * 增加承运商
     * @param agent
     * @return
     */
    @PostMapping("/addAgent")
    public R addAgent(Agent agent){
        return agentService.addAgent(agent);
    }

    /**
     * 删除承运商
     * @param agent_id
     * @return
     */
    @PostMapping("/deleteAgent")
    public R deleteAgent(Integer agent_id){
        return agentService.deleteAgent(agent_id);
    }
    /**
     * 批量删除承运商
     * @param agent_ids
     * @return
     */
    @PostMapping("/deleteAgentlList")
    public R deleteAgentList(int[] agent_ids){
        return agentService.deleteAgentList(agent_ids);
    }

    /**
     * 修改承运商
     * @param agent
     * @return
     */
    @PostMapping("/updateAgent")
    public R updateAgent(Agent agent){
        return agentService.updateAgent(agent);
    }

    /**
     * 查看承运商
     * @param agentId
     * @return
     */
    @GetMapping("/seeAgent")
    public JsonResult seeAgent(Integer agentId){
        return agentService.seeAgent(agentId);
    }

    /**
     * 条件搜索承运商
     * @param name
     * @param type
     * @param createDate
     * @return
     */
    @PostMapping("/searchAgent")
    public JsonResult searchAgent(String name, String type, String createDate){
        return agentService.searchAgent(name,type,createDate);
    }

}
